﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Expression.Blend.DataStore.DataStore;

namespace MeasurementTools
{

	public partial class SettingItem : UserControl
	{
        SolidColorBrush m_border_BorderBrush;
        SolidColorBrush m_brushBorderBackground;
        SolidColorBrush m_brushBorderSelected;
        SolidColorBrush m_brushTextForeground;

        public DelegateUpdatePositionOfAllPropertyWindow m_delegateUpdateAllPropertyWindow = null;
        public DelegateSetPositionPreviewEnable M_delegateSetPositionPreviewEnable = null;
        public DelegateSetDisplayFontSize M_delegateSetDisplayFontSize = null;

        DataStore m_dataStore;
        private static SettingItem m_instance = null;


		public SettingItem()
		{
			this.InitializeComponent();

            m_dataStore = this.FindResource("DataStore") as DataStore;
            m_dataStore.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(m_dataStore_PropertyChanged);
		}

        void m_dataStore_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (m_dataStore.isMoveAllPropertyWindow == true)
                m_check_moveAllPropertyWindow.IsChecked = true;
            else
                m_check_moveAllPropertyWindow.IsChecked = false;

            if (m_dataStore.isShowPreviewWindow == true)
            {
                m_check_showPreviewWindow.IsChecked = true;
            }
            else
            {
                m_check_showPreviewWindow.IsChecked = false;
            }

            if (M_delegateSetPositionPreviewEnable != null)
                M_delegateSetPositionPreviewEnable(m_dataStore.isShowPreviewWindow);
        }


        public void UpdateFontSizeSetting()
        {
            if (M_delegateSetDisplayFontSize != null)
                M_delegateSetDisplayFontSize(combo_fontSize.SelectedIndex);
        }


//         public bool GetIsUpdateAllPropertyWindow()
//         {
//             return m_dataStore.isMoveAllPropertyWindow; 
//         }
//         public void updateAllPropertyWindow()
//         {
//             if ( m_delegateUpdateAllPropertyWindow != null)
//                 m_delegateUpdateAllPropertyWindow();
//         }
	}
}